/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.business.service.impl;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.business.domain.vo.SqrjkVo;
import me.zhengjie.business.domain.vo.ZhgkxmVo;
import me.zhengjie.business.repository.SnryRepository;
import me.zhengjie.business.repository.ZhsqRepository;
import me.zhengjie.business.service.dto.SqrjkQueryCriteria;
import me.zhengjie.business.service.mapstruct.SqrjkService;
import me.zhengjie.utils.PageUtil;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
* @website https://el-admin.vip
* @description 服务实现
* @author xiahongbo
* @date 2022-05-25
**/
@Slf4j
@Service
@RequiredArgsConstructor
public class SqrjkServiceImpl implements SqrjkService {

    private final SnryRepository snryRepository;
    private final ZhsqRepository zhsqRepository;

    @Override
    public Map<String,Object> querySqrjk(SqrjkQueryCriteria criteria, Pageable pageable){
        Page<SqrjkVo> page =  snryRepository.querySqrjk(criteria.getBlurry(), pageable);
        return PageUtil.toPage(page);
    }

    @Override
    public Map<String, Object> queryBySqrid(String blurry, String area, String ylddbm, Long userId, Pageable pageable) {
        Page<ZhgkxmVo> page =  zhsqRepository.queryBySqrid(blurry,area ,ylddbm , userId, pageable);
        return PageUtil.toPage(page);
    }

}